package com.king.zxing.app;

import android.app.Activity;
import android.os.Build;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.EditText;
import android.widget.ImageView;

import com.king.zxing.app.util.GenerateQrCodeUtil;

public class ShowViewActivity extends Activity {
    private String content;
    private ImageView image;
    private static EditText inputname;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.activity_showview);
        inputname = findViewById(R.id.showname);
        image=findViewById(R.id.showimage);
        //Set noTitleBar.
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
            Window window = getWindow();
            this.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
            if (window != null) {
                window.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS | WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
            }
        }
    }

    @Override
    public void onBackPressed() {
        super.onBackPressed();
        GenerateQrCodeUtil.closeHandler();
        finish();
    }

    public void showOnClick(View v){
        content = inputname.getText().toString();
        GenerateQrCodeUtil.showQrCode(ShowViewActivity.this,content,image);
    }
}